﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Core.DS;

namespace Web.Controllers
{
    public partial class datastructController : JsonController
    {
        public ActionResult getExperimentList(int start, int limit)
        {
            return Json(experiment.getExperimentList(start, limit, Certify.username));
        }

        [OnlyTeacherUp]
        public ActionResult addOrEditExperiment(int? eid, string title, string description, string startTime, string endTime)
        {
            CheckEmpty(title, endTime);
            return Json(experiment.addOrEditExperiment(eid, title, description.ToQ(), CheckDateQ(startTime), CheckDate(endTime)));
        }

        public ActionResult getExperimentInfo(int eid)
        {
            return Json(experiment.getExperimentInfo(eid));
        }

        [OnlyTeacherUp]
        public ActionResult deleteExperiment(int eid)
        {
            return Json(experiment.deleteExperiment(eid));
        }
        [OnlyTeacherUp]
        public ActionResult swapEOrder(bool flags,int eid)
        {
            return Json(experiment.swapEOrder(flags, eid));
        }
    }
}
